#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

typedef struct
{
    string name;
    int chinese;
    int math;
    int english;
    int total;
    int index;
} Data;

bool compare(const Data& a, const Data& b)
{
    if (a.total > b.total) return true;
    if (b.total > a.total) return false;
    if (a.index < b.index) return true;
    return false;
}

int main(int argc, char const *argv[])
{
    Data temp, datas[1024];
    int n, i;

    cin >> n;
    for (i = 0; i < n; i++)
    {
        cin >> temp.name 
            >> temp.chinese 
            >> temp.math 
            >> temp.english;
        temp.total = temp.chinese + temp.math + temp.english;
        temp.index = i;
        datas[i] = temp;
    }

    sort(datas, datas + n, compare);

    cout << datas[0].name 
        << " "
        << datas[0].chinese
        << " "
        << datas[0].math
        << " "
        << datas[0].english;

    return 0;
}
